<?php

//UMA new
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateContactInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('contact_infos', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('first_name', 50)->comment('姓');
            $table->string('last_name', 50)->comment('名');
            $table->string('first_name_kana', 50)->comment('セイ');
            $table->string('last_name_kana', 50)->comment('メイ');
            $table->date('bod')->comment('生年月日');
            $table->string('zip', 50)->comment("自宅郵便番号");
            $table->string('pref', 50)->comment('自宅住所(都道府県)');
            $table->string('city', 50)->comment('自宅住所（市区町村）');
            $table->string('town', 255)->comment('自宅住所（番地）');
            $table->string('building', 255)->nullable()->comment('自宅住所（建物名・部屋番号）');

            $table->string('email', 255)->comment('電子メールアドレス');
            $table->string('mobile', 11)->comment('携帯電話番号');
            $table->string('tel', 11)->nullable()->comment('電話番号');
            $table->json('first_contact_date')->comment('優先連絡日付');
            $table->json('second_contact_date')->comment('再選連絡日付');
            $table->string('region', 255)->comment('住宅購入ご検討エリア');
            $table->string('real_estate_info', 50)->nullable()->comment('不動産会社情報');
            $table->text('message')->nullable()->comment('伝言内容');
            $table->boolean('privacy_term_accepted')->comment('条件に同意する 1:同意; 0:同意しない');
            $table->unsignedBigInteger('customer_history_id')->comment('会員履歴情報ID');

            //$table->unsignedBigInteger('customer_id')->comment('顧客情報ID');
            $table->string('temporary_member_id', 64)->comment('会員仮ID');
            $table->timestamps();
            $table->foreign('customer_history_id')->references('id')->on('customer_histories');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('contact_infos');
    }
}
